/**
 * 
 */
package com.teamall.web.app.common;

import org.springframework.web.bind.MissingServletRequestParameterException;

import com.teamall.web.base.vo.ResResult;

/**
 * <Description> <br>
 * 
 * @author pan.xiaobo<br>
 * @version 1.0<br>
 * @taskId <br>
 * @CreateDate 2017年8月6日 <br>
 * @since V1.0<br>
 * @see com.teamall.web.app.common <br>
 */

public class ResultFactory {

    /**
     * 系统发生异常
     * 
     * @return
     */
    public static ResResult getExceptionResult() {
        ResResult result = new ResResult();
        result.setCode("9001");
        result.setMsg("系统发生异常");
        result.setRspData("");
        return result;
    }

    /**
     * 请求参数错误
     * 
     * @return
     */
    public static ResResult getRequestParamsError() {
        ResResult result = new ResResult();
        result.setCode("7000");
        result.setMsg("请求参数错误，必要的参数不能为空");
        result.setRspData("");
        return result;
    }

    /**
     * 请求方法必须为post
     * 
     * @return
     */
    public static ResResult getHttpRequestMethodNotSupportedError() {
        ResResult result = new ResResult();
        result.setCode("7001");
        result.setMsg("请求方法必须为POST");
        result.setRspData("");
        return result;
    }

    /**
     * 缺少必要的参数
     * 
     * @return
     */
    public static ResResult getMissingServletRequestParameterException() {
        ResResult result = new ResResult();
        result.setCode("7002");
        result.setMsg("缺少必要的参数");
        result.setRspData("");
        return result;
    }

    /**
     * 参数类型不匹配
     * 
     * @return
     */
    public static ResResult getTypeMismatchException() {
        ResResult result = new ResResult();
        result.setCode("7003");
        result.setMsg("参数类型不匹配");
        result.setRspData("");
        return result;
    }

    /**
     * 参数类型不对或转换异常
     * 
     * @return
     */
    public static ResResult getBindException() {
        ResResult result = new ResResult();
        result.setCode("7004");
        result.setMsg("参数类型不正确或转换异常");
        result.setRspData("");
        return result;
    }

    /**
     * 该条件下的数据已存在
     * 
     * @return
     */
    public static ResResult getExistDataException() {
        ResResult result = new ResResult();
        result.setCode("7005");
        result.setMsg("该条件下的数据已存在");
        result.setRspData("");
        return result;
    }

    /**
     * 查询不到数据
     * 
     * @return
     */
    public static ResResult getUnableQryData() {
        ResResult result = new ResResult();
        result.setCode("10000");
        result.setMsg("查询不到数据");
        result.setRspData("");
        return result;
    }

}
